package com.example.work4.data

import androidx.room.*
import com.example.work4.data.Record

@Dao
interface RecordDao {
    @Insert
    fun insert(vararg records: Record?)

    @Delete
    fun delete(vararg records: Record?)

    @Query("DELETE FROM record")
    fun deleteAll()

    @Update
    fun update(vararg records: Record?)

    @Query("SELECT * FROM record")
    fun getAll(): List<Record?>?

    @Query("SELECT * FROM record LIMIT (:page * :size) - :size, :size")
    fun getByOffset(page: Int, size: Int): List<Record?>?

    @Query("SELECT * FROM record WHERE id = :id")
    fun getById(id: Int): List<Record?>?

}